﻿<UserControl x:Class="YoderZone.Extensions.Options.Controls.ColorPicker"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:controls1="clr-namespace:YoderZone.Extensions.Options.Controls"
             xmlns:elements1="clr-namespace:YoderZone.Extensions.Options.Controls.Elements"
             d:DesignWidth="300"
             mc:Ignorable="d">
    <Grid DataContext="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type controls1:ColorPicker}}}">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="25" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="18" />
            <RowDefinition Height="18" />
            <RowDefinition Height="18" />
        </Grid.RowDefinitions>


        <elements1:ColorView Grid.RowSpan="3"
                            Width="44"
                            Height="44"
                            Margin="4,0"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            BlueValue="{Binding BlueValue,
                                                Mode=TwoWay}"
                            ColorSwath="{Binding ColorSwath}"
                            GreenValue="{Binding GreenValue,
                                                 Mode=TwoWay}"
                            RedValue="{Binding RedValue,
                                               Mode=TwoWay}" />

        <elements1:TinySlider Grid.Row="0"
                             Grid.Column="1"
                             Value="{Binding RedValue,
                                             Mode=TwoWay}" />
        <elements1:TinySlider Grid.Row="1"
                             Grid.Column="1"
                             Value="{Binding GreenValue,
                                             Mode=TwoWay}" />
        <elements1:TinySlider Grid.Row="2"
                             Grid.Column="1"
                             Value="{Binding BlueValue,
                                             Mode=TwoWay}" />

        <elements1:ColorView Grid.Row="0"
                            Grid.Column="2"
                            Width="12"
                            Height="12"
                            Margin="6,0"
                            BlueValue="0"
                            GreenValue="0"
                            RedValue="{Binding RedValue,
                                               Mode=OneWay}" />
        <elements1:ColorView Grid.Row="1"
                            Grid.Column="2"
                            Width="12"
                            Height="12"
                            Margin="6,0"
                            BlueValue="0"
                            GreenValue="{Binding GreenValue,
                                                 Mode=OneWay}"
                            RedValue="0" />
        <elements1:ColorView Grid.Row="2"
                            Grid.Column="2"
                            Width="12"
                            Height="12"
                            Margin="6,0"
                            BlueValue="{Binding BlueValue,
                                                Mode=OneWay}"
                            GreenValue="0"
                            RedValue="0" />

        <TextBlock Grid.Row="0"
                   Grid.Column="3"
                   HorizontalAlignment="Right"
                   Text="{Binding RedValue,
                                  FallbackValue=0,
                                  StringFormat=\{0:0\},
                                  TargetNullValue=0}" />
        <TextBlock Grid.Row="1"
                   Grid.Column="3"
                   HorizontalAlignment="Right"
                   Text="{Binding GreenValue,
                                  FallbackValue=0,
                                  StringFormat=\{0:0\},
                                  TargetNullValue=0}" />
        <TextBlock Grid.Row="2"
                   Grid.Column="3"
                   HorizontalAlignment="Right"
                   Text="{Binding BlueValue,
                                  FallbackValue=0,
                                  StringFormat=\{0:0\},
                                  TargetNullValue=0}" />

    </Grid>
</UserControl>
